package com.fairytask.ui
{
	import com.fairytask.engine.components.button.Button;
	import com.fairytask.engine.components.clip.Clip;
	import com.fairytask.engine.define.UIDefine;
	import com.fairytask.resource.StaticIni;
	import com.fairytask.ui.base.FrameUI;
	import com.fairytask.ui.petsUnit.PetEquipUI;
	import com.fairytask.ui.petsUnit.PetsListUI;
	
	/**
	 * 宠物UI 
	 * @author xujh
	 * 
	 */
	public class PetsUI extends FrameUI
	{
		private static var _self		:PetsUI;
		
		public var mainBg	:Clip;	//主要显示部分背景
		
		private var pageBtn	:Button;	//临时按钮
		
		private var _petsList	:PetsListUI	=	PetsListUI.getInstance();
		
		public var petEquip	:PetEquipUI	=	PetEquipUI.getInstance();
		
		public static function getInstance():PetsUI
		{
			if (_self == null)
			{
				_self=new PetsUI;
			}
			return _self;
		}
		
		public function PetsUI(popUI:Boolean=true)
		{
			super(popUI);
			init();
		}
		
		/**
		 * 初始化 
		 * 
		 */
		private function init():void
		{
			//左侧显示固定的属性面板
			_petsList.x = 15;
			_petsList.y = 10;
			windowBG.addChild(_petsList);
			petEquip.x = 90;
			petEquip.y = 0;
			windowBG.addChild(petEquip);
			//设置面板显示位置
			btnBlank = 2;
			setBtnPos(350,29);
			setUnitPos(350,55);
			
			pageBtn  = new Button(StaticIni.getSwfLangStr("1000000220"),46,25,"button_036");
			addButton(pageBtn);
			pageBtn  = new Button(StaticIni.getSwfLangStr("1000000221"),46,25,"button_036");
			pageBtn.enabled = false;
			addButton(pageBtn);
			pageBtn  = new Button(StaticIni.getSwfLangStr("1000000222"),46,25,"button_036");
			addButton(pageBtn);
			addShowUI([[UIDefine.PetsProfileUI]],0);
			addShowUI([[UIDefine.PetsFuseUI]],1);
			addShowUI([[UIDefine.PetsSwallowUI]],2);
		}
		
		override public function show(space:String=MIDDLELAYER, onshow:Function=null):void
		{
			super.show(space,onshow);
			_petsList.reset();
		}
	}
}